<%--
  Created by IntelliJ IDEA.
  User: 秋梓
  Date: 2021/12/6
  Time: 21:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<a href="UserManageServlet">返回</a><br/><br/>
------------ 用户 ${param.username} 的订单信息 ------------
<br/><br/>
<c:set var="total" value="${0}"/>
<table>
    <c:forEach items="${booksWillSelectedIntoShowCart}" var="book">
        <c:set var="total" value="${total + book.getPrice() * book.getCurrentNum()}"/>
        <c:if test="${sessionScope.userCartList.toString().contains(book.getName())}">
            <tr>
                <td><c:out value="序列号:${book.getId()}"/></td>
                <td><c:out value="书名:《${book.getName()}》"/></td>
                <td><c:out value="作者:${book.getAuthor()}"/></td>
                <td><c:out value="类型:${book.getType()}"/></td>
                <td><c:out value="价格:${book.getPrice()}￥"/></td>
                <td><c:out value="数目:${book.getCurrentNum()}本"/></td>
            </tr>
        </c:if>
    </c:forEach>
</table>
<br/>
<c:if test="${total.toString().length() > 6}">
    <c:out value=" 合计:${total.toString().substring(0, 5)}￥"/>
</c:if>
<c:if test="${total.toString().length() < 6}">
    <c:out value=" 合计:${total}￥"/>
</c:if>


</body>
</html>
